import { Table } from "antd";
import { TableComProps } from "@/configs/types";

export default function TableCom(props: TableComProps) {
  const {
    dataSource,
    columns,
    paginationOptions,
    rowSelection,
    className,
    expandable,
  } = props;

  return (
    <Table
      className={className}
      rowKey={(record) => record.id}
      dataSource={dataSource}
      columns={columns}
      rowSelection={
        rowSelection ? { type: "checkbox", ...rowSelection } : undefined
      }
      pagination={paginationOptions}
      scroll={{ y: "400px", x: "max-content" }}
      expandable={expandable}
    />
  );
}
